Repository navigation
5.4.0 → 5.7.0: Paper on Brigadier, Component messages, unregisterAll, @Default, describe() - #58
Merged
Merged
Conversation
- The CommandManager constructor no longer calls Updater.checkUpdates(); -Dcommands.updater=false turns an explicit check off too, and versions are compared as versions so a newer or uncomparable build is never announced as outdated. - CommandManager#unregisterAll() removes every command the manager registered, and only those. - Requirement#name() fills %requirement% when errorMessage() is empty. - Spigot: an unregistered command is removed from the known commands, not just marked; Spigot and Velocity no longer remove a label another plugin holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
A new adventure-addon module adds ComponentMessageFormatter: it receives each message by its MessageKey with its values (arg, requirement, usage) apart, and the component it builds is sent as a component, so click and hover events survive. The Velocity manager exposes setComponentFormatter. The core stays free of Adventure: it gains MessageKey, MessageDispatcher and CommandManager#sendMessage(receiver, key, text, values), which falls back on the unchanged text path when no dispatcher is set or it declines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
platform-paper registers commands through LifecycleEvents.COMMANDS: typed arguments become Brigadier nodes, permission and requirements the node's requires, and running a node goes through the usual invoker. BrigadierCommandTree holds the translation, testable with Brigadier alone; paper-test-plugin exercises it on a real server. Tested on Paper 1.21.4 and 26.3: a label registered after startup answers after the next /minecraft:reload, an unregistered command is hidden by its requires and answers as unknown. The README documents it. Also fixes ComponentMessageFormatter.miniMessage leaving the tags of absent values as typed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
- Annotations: @default("value") makes an argument optional, the value being converted by the parameter type's converter when it is left out; an invalid default on a primitive is refused at registration. - CommandManager#describe() returns a public, read-only tree of command and argument descriptions, for generating command documentation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn
Up to standards ✅🟢 Issues
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The changes asked for by Valkn (a Paper 26.3 / Java 25 plugin stack built on CommandsAPI), delivered as four minor versions, one commit each, with a
CHANGELOG.mdand a README section per feature. Nothing changes for code that does not use the new APIs, except the points under Behaviour changes. The tests that existed in 5.3.1 pass unmodified.5.4.0: no network call on startup,
unregisterAll, requirement namesCommandManagerconstructor no longer callsUpdater.checkUpdates().-Dcommands.updater=falseturns even an explicit call off. Versions are compared as versions, so a local version newer than the published one (a snapshot, a build named after a commit), or a failed check, announces nothing.CommandManager#unregisterAll()removes every command the manager registered, with its aliases and subcommands, and only those.Requirement#name()(default: the simple class name) fills%requirement%whenerrorMessage()is empty. A non-emptyerrorMessage()is still sent as-is, so existing messages read the same.5.5.0: messages as
Componentadventure-addonmodule:ComponentMessageFormatter<S>receives theMessageKeyand the values (arg,requirement,usage) separately, never substituted into the text. The component is sent as a component, so click and hover events survive.ComponentMessageFormatter.miniMessage(...)reads MiniMessage templates, from a function or from aMessageHandler.setComponentFormatteron the Velocity manager, and on the new Paper one in 5.6.0.MessageKey,MessageDispatcher,CommandManager#sendMessage(receiver, key, text, values)andMessageHandler#getMessage(key). Without a dispatcher, the text path is unchanged.5.6.0:
platform-paperon BrigadierLifecycleEvents.COMMANDS:Infinite(as a greedy string) become typed Brigadier nodes;String, custom converters, and numbers read by a plugin's own converter become a word, with the tab completer's suggestions.requires. Running a node goes through the usual invoker.BrigadierCommandTreeholds the translation and can be tested with Brigadier alone.paper-test-pluginfor manual testing./minecraft:reload;requiresand answers as unknown;miniMessage(...)left the tag of an absent value as typed (<arg>in aUSAGEmessage); absent values are now empty.5.7.0:
@Defaultanddescribe()@Default("1")makes an annotated argument optional. The value is converted by the parameter type's converter. On anOptionalit is wrapped. An invalid default on a primitive is refused at registration. TheOptional<T>support that already existed is now documented.manager.describe()returns a public, read-only tree ofCommandDescription/ArgumentDescription:Behaviour changes
unregisterCommandnow really removes the command (see the 5.4.0 fix).platform-paper, which is new:Stringargument only accepts vanilla word characters; declare itInfiniteto accept any text.Tests
Componentwith a click and a hover arriving intact; a Brigadier integer argument refused by the parser;unregisterAllleaving another manager's commands, both on the core and on a real SpigotSimpleCommandMap.canUseunit tests and on the server console, which parses with the same tree.🤖 Generated with Claude Code
https://claude.ai/code/session_01Se3hcX6fCyfEU3PuabuUyn